package com.estate.web.controller.report.home;

import com.estate.system.domain.vo.SystemLogVo;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class SystemLogDataGenerator {
    
    /**
     * 生成模拟订单数据列表
     * 包含图片中的6条数据 + 4条模拟数据
     */
    public static List<SystemLogVo> generateOrderList() {
        List<SystemLogVo> orders = new ArrayList<>();
        
        // 添加图片中的6条数据
        orders.add(new SystemLogVo("00001", "Christine Brooks", "089 Kutch Green Apt. 448", 
                LocalDate.of(2019, 2, 14), "Electric", SystemLogVo.OrderStatus.COMPLETED));
        
        orders.add(new SystemLogVo("00002", "Rosie Pearson", "979 Immanuel Ferry Suite 526", 
                LocalDate.of(2019, 2, 14), "Book", SystemLogVo.OrderStatus.PROCESSING));
        
        orders.add(new SystemLogVo("00003", "Darrell Caldwell", "8587 Frida Ports", 
                LocalDate.of(2019, 2, 14), "Medicine", SystemLogVo.OrderStatus.REJECTED));
        
        orders.add(new SystemLogVo("00004", "Gilbert Johnston", "768 Destiny Lake Suite 600", 
                LocalDate.of(2019, 2, 14), "Mobile", SystemLogVo.OrderStatus.COMPLETED));
        
        orders.add(new SystemLogVo("00005", "Alan Cain", "042 Mylene Throughway", 
                LocalDate.of(2019, 2, 14), "Watch", SystemLogVo.OrderStatus.PROCESSING));
        
        orders.add(new SystemLogVo("00006", "Alfred Murray", "543 Weimann Mountain", 
                LocalDate.of(2019, 2, 14), "Medicine", SystemLogVo.OrderStatus.COMPLETED));
        
        // 添加4条模拟数据，保持与图片相同的格式
        orders.add(new SystemLogVo("00007", "Emma Wilson", "123 Oak Street Apt. 101", 
                LocalDate.of(2019, 2, 15), "Clothing", SystemLogVo.OrderStatus.PROCESSING));
        
        orders.add(new SystemLogVo("00008", "Michael Brown", "456 Pine Avenue Suite 202", 
                LocalDate.of(2019, 2, 15), "Food", SystemLogVo.OrderStatus.COMPLETED));
        
        orders.add(new SystemLogVo("00009", "Sarah Davis", "789 Maple Road", 
                LocalDate.of(2019, 2, 16), "Furniture", SystemLogVo.OrderStatus.REJECTED));
        
        orders.add(new SystemLogVo("00010", "James Miller", "321 Elm Boulevard Apt. 305", 
                LocalDate.of(2019, 2, 16), "Book", SystemLogVo.OrderStatus.PROCESSING));
        
        return orders;
    }
    
    /**
     * 生成随机订单数据（可选方法）
     */
    public static List<SystemLogVo> generateRandomOrders(int count) {
        List<SystemLogVo> orders = new ArrayList<>();
        Random random = new Random();
        
        String[] firstNames = {"John", "Jane", "Robert", "Emily", "Michael", "Sarah", "David", "Lisa", "Chris", "Amanda"};
        String[] lastNames = {"Smith", "Johnson", "Williams", "Brown", "Jones", "Garcia", "Miller", "Davis", "Rodriguez", "Martinez"};
        String[] streetNames = {"Main", "Oak", "Pine", "Maple", "Cedar", "Elm", "Washington", "Lincoln", "Lake", "Park"};
        String[] streetTypes = {"Street", "Avenue", "Road", "Boulevard", "Drive", "Way"};
        
        for (int i = 1; i <= count; i++) {
            String id = String.format("%05d", i);
            String firstName = firstNames[random.nextInt(firstNames.length)];
            String lastName = lastNames[random.nextInt(lastNames.length)];
            String name = firstName + " " + lastName;
            
            String address = (random.nextInt(1000) + 1) + " " + 
                           streetNames[random.nextInt(streetNames.length)] + " " + 
                           streetTypes[random.nextInt(streetTypes.length)] + 
                           (random.nextBoolean() ? " Apt. " + (random.nextInt(500) + 1) : "");
            
            LocalDate date = LocalDate.of(2019, 2, 10 + random.nextInt(10)); // 2019年2月10-20日
            
            SystemLogVo.ProductType[] productTypes = SystemLogVo.ProductType.values();
            String type = productTypes[random.nextInt(productTypes.length)].getDisplayName();
            
            SystemLogVo.OrderStatus[] statuses = SystemLogVo.OrderStatus.values();
            SystemLogVo.OrderStatus status = statuses[random.nextInt(statuses.length)];
            
            orders.add(new SystemLogVo(id, name, address, date, type, status));
        }
        
        return orders;
    }
}